package com.example.demo.service;

import com.example.demo.entity.Articleinfo;
import com.example.demo.mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:龙宝
 * Date:2023-04-02
 * Time:10:49
 */
@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;
    public int getArtCountByUid(Integer uid) {
        return articleMapper.getArtCountByUid(uid);
    }
    //查询个人文章/草稿
    public List<Articleinfo> getMyList(Integer uid,Integer state) {
        return articleMapper.getMyList(uid,state);
    }

    public int del(Integer uid,Integer id) {
        return articleMapper.del(uid,id);
    }

    public Articleinfo getDetail(Integer id) {
        return articleMapper.getDetail(id);
    }

    public int upRCount(Integer id) {
        return articleMapper.upRCount(id);
    }
    //阅读量
    public int getArtRCount(Integer id) {
        return articleMapper.getArtRCount(id);
    }
    public int add(Articleinfo articleinfo) {
        return articleMapper.add(articleinfo);
    }
    public int edit(Articleinfo articleinfo) {
        return articleMapper.edit(articleinfo);
    }

    //文章总数
    public int artCount() {
        return articleMapper.artCount();
    }
    //分页查询
    public List<Articleinfo> listPage(int size,int index) {
        return articleMapper.listPage(size,index);
    }

    //草稿保存
    public int myDraft(Articleinfo articleinfo) {
        return articleMapper.myDraft(articleinfo);
    }
    //
    public int serchArt(Articleinfo articleinfo) {
        return articleMapper.serchArt(articleinfo);
    }

}
